<?php
namespace App\Config;

use Phalcon\Mvc\Router;

$router = new Router(false);

$router->setDefaultNamespace('App\Controllers');
$router->setDefaultController('index');
$router->setDefaultAction('index');
$router->setUriSource(Router::URI_SOURCE_SERVER_REQUEST_URI);
$router->removeExtraSlashes(true);

$router->notFound([
    'namespace'  => 'App\Controllers',
    "controller" => "exception",
    "action"     => "show404"
]);

$router->add('/index.php', [
    'namespace'  => 'App\Controllers',
    'controller' => 'index',
    'action'     => 'index',
]);

$router->add('/', [
    'namespace'  => 'App\Controllers',
    'controller' => 'index',
    'action'     => 'index',
]);
$router->add('/:controller', [
    'namespace'  => 'App\Controllers',
    'controller' => 1,
    'action'     => 'index',
]);
$router->add('/:controller/:action/:params', [
    'namespace'  => 'App\Controllers',
    'controller' => 1,
    'action'     => 2,
    'params'     => 3,
]);

/*****************************************短信接口配置*******************************************/
$router->add('/sms\/?([a-zA-Z0-9_-]*)\/?([a-zA-Z0-9_]*)/:params', [
    'namespace'  => 'App\Controllers\Sms',
    "controller" => 1,
    "action"     => 2,
    'params'     => 3,
]);
$router->add('/sms\/mt/:params', [
    'namespace'  => 'App\Controllers\Sms',
    "controller" => 'index',
    "action"     => 'mt',
    'params'     => 1,
]);
$router->add('/sms\/notice/:params', [
    'namespace'  => 'App\Controllers\Sms',
    "controller" => 'index',
    "action"     => 'notice',
    'params'     => 1,
]);
$router->add('/sms\/saleforce/:params', [
    'namespace'  => 'App\Controllers\Sms',
    "controller" => 'index',
    "action"     => 'saleforce',
    'params'     => 1,
]);

/*****************************************短信查询接口*************************************/
$router->add('/sms\/query/:params', [
    'namespace'  => 'App\Controllers\Sms',
    "controller" => 'j',
    "action"     => 'query',
    'params'     => 1,
]);

/*****************************************短信统计配置**********************************************/
$router->add('/stat\/?([a-zA-Z0-9_-]*)\/?([a-zA-Z0-9_]*)/:params', [
    'namespace'  => 'App\Controllers\Stat',
    "controller" => 1,
    "action"     => 2,
    'params'     => 3,
]);

/*****************************************会员营销配置**********************************************/
$router->add('/project\/?([a-zA-Z0-9_-]*)\/?([a-zA-Z0-9_]*)/:params', [
    'namespace'  => 'App\Controllers\Project',
    "controller" => 1,
    "action"     => 2,
    'params'     => 3,
]);

/*****************************************个人中心配置**********************************************/
$router->add('/my\/?([a-zA-Z0-9_-]*)\/?([a-zA-Z0-9_]*)/:params', [
    'namespace'  => 'App\Controllers\My',
    "controller" => 1,
    "action"     => 2,
    'params'     => 3,
]);

$router->add('/sys\/?([a-zA-Z0-9_-]*)\/?([a-zA-Z0-9_]*)/:params', [
    'namespace'  => 'App\Controllers\Sys',
    "controller" => 1,
    "action"     => 2,
    'params'     => 3,
]);

return $router;